package com.ss.android.article.base.feature.detail2.video.a;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;

import com.ss.android.b.a.AdsAppItem;
import com.ss.android.common.lib.MobClickCombiner;
import com.ss.android.newmedia.util.AppUtil;

import org.json.JSONObject;

final class b implements View.OnClickListener {
    private final a a;

    b(a arg1) {
        this.a = arg1;

    }

    public final void onClick(View arg11) {
        String v2;
        JSONObject v8 = null;
        JSONObject v9 = null;
        if (this.a.i != null && this.a.i.url != null) {
            try {
                v8 = new JSONObject();
                if (android.support.design.a.isTextEmpty(this.a.h.logExtra)) {
                } else {
                    v8.put("log_extra", this.a.h.logExtra);
                }
            } catch (Exception v0) {
            }
            Context v1 = this.a.a;
            a v0_1 = this.a;
            if ("app".equals(v0_1.h.type)) {
                v2 = "detail_download_ad";
            } else if ("action".equals(v0_1.h.type)) {
                v2 = "detail_call";
            } else if ("web".equals(v0_1.h.type)) {
                v2 = "embeded_ad";
            } else {
                v2 = "";
            }

            MobClickCombiner.onEvent(v1, v2, "click_card", this.a.h.id, 0, v8);
            if (this.a.h == null) {
                AppUtil.b(this.a.a, this.a.i.url);
                return;
            }

            if ("app".equals(this.a.h.type)) {
                if (TextUtils.isEmpty(this.a.h.webUrl)) {
                    this.a.h.webUrl = this.a.i.url;
                }
                this.a.h.a(this.a.a, 1);
            } else {
                AdsAppItem.a(this.a.a, "", this.a.i.url, "", this.a.h.orientation, new AdsAppItem.b(this.a.a, "detail_ad", ((String) null), this.a.h.id, this.a.h.logExtra));
            }
        }
    }
}

